package com.ego.order.controller;

import java.util.Arrays;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.ego.order.po.RefundInfo;
import com.ego.order.service.RefundInfoService;
import com.ego.common.util.Result;

/**
 * @program: ego
 * @description 退款信息控制器
 * @author KamTang
 * @date 2022-11-13 11:25:07
 */
@RestController
@RequestMapping("order/refundinfo")
public class RefundInfoController {

    @Autowired
    private RefundInfoService refundInfoService;

    /**
     * 信息
     */
    @GetMapping("/get/{id}")
    public Result get(@PathVariable("id") Long id){
		RefundInfo refundInfo = refundInfoService.getById(id);
        return Result.ok().put("refundInfo", refundInfo);
    }

    /**
     * 保存
     */
    @PostMapping("/save")
    public Result save(@RequestBody RefundInfo refundInfo){
		refundInfoService.save(refundInfo);
        return Result.ok();
    }

    /**
     * 修改
     */
    @PostMapping("/update")
    public Result update(@RequestBody RefundInfo refundInfo){
		refundInfoService.updateById(refundInfo);
        return Result.ok();
    }

    /**
     * 删除
     */
    @PostMapping("/delete")
    public Result delete(@RequestBody Long[] ids){
		refundInfoService.removeByIds(Arrays.asList(ids));
        return Result.ok();
    }

}
